#ifndef GAMEROOM_H
#define GAMEROOM_H

#pragma once

#include <QWidget>
#include <QPushButton>
#include <QSound>

class GameRoom : public QWidget
{
    Q_OBJECT
public:
    enum Direction
    {
        UP = 0,
        DOWN,
        LEFT,
        RIGHT
    };
    explicit GameRoom(QWidget *parent = nullptr);
    void paintEvent(QPaintEvent *event);
    void moveUp();
    void moveDown();
    void moveLeft();
    void moveRight();
    void createFood();
    bool isFailed();
    void setMoveTimeout(int timeout);

private:
    void setButtonAttribute(QPushButton* button, const QString& text);

    const int snakeNodeWidth = 20;
    const int snakeNodeHeight = 20;
    const int defaultTimeOut = 200;
    QList<QRectF> snakeList;
    Direction moveDirection = UP;
    QRectF foodPos;
    QTimer* timer;
    bool isGameStart = false;
    QSound* sound;
    int moveTimeout;

signals:

};

#endif // GAMEROOM_H
